package personal.zq.practice.common.utils;

/**
 * 应用工具类
 *
 * @version 1.0
 * @date 2022/9/21
 */
public class AppUtil {


    private volatile static AppUtil app = null;

    private AppUtil() {
    }

    public static synchronized AppUtil getInstance() {
        if (app == null) {
            synchronized (AppUtil.class) {
                if (app == null) {
                    app = new AppUtil();
                }
            }
        }
        return app;
    }

    public static void setAppUserInfo(AppUserInfo appUserInfo) {
        ThreadContextUtil.getInstance().set("appUserInfoKey", appUserInfo);
    }

    public static AppUserInfo getAppUserInfo() {
        return (AppUserInfo) ThreadContextUtil.getInstance().get("appUserInfoKey");
    }

    public static void clean() {
        ThreadContextUtil.getInstance().clean();
    }
}
